from datetime import date, timedelta
from random import randint
import calendar

def build_birthday(list_person_name:list):
    name_birthday = {}.fromkeys(list_person_name)
    for key in name_birthday:
        year = randint(1990, 1999)
        month = randint(1, 12)
        if calendar.isleap(year) == True:
            if month == 2:
                day = randint(1, 29)
            else:
                day = randint(1, 30)
        else:
            if month == 2:
                day = randint(1, 28)
            else:
                day = randint(1, 30)
        name_birthday[key] = date(year,month,day)
    return name_birthday

def person_birthday_summer(name_birthday:dict):
    list_person = []
    for key in name_birthday:
        if name_birthday[key].month >= 6 and name_birthday[key].month <= 8:
            list_person.append(key)
    return  list_person

if __name__ == '__main__':

    name_list = ["赵一", "杨二", "张三", "李四", "王五", "赵六", "马七", "郑八", "刘九", "胡十"]
    d = build_birthday(name_list)
    print(d)
    a = person_birthday_summer(d)
    print(a)


